package com.lottery.ruok.lottrey.ui.component;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;

import com.lottery.ruok.lottrey.R;

import utils.Utils;

/**
 * 充值银行卡信息view
 */
public class BankInfoView extends BaseRelativeLayout {

    private BankInfoItemView mUserName;
    private BankInfoItemView mBankName;
    private BankInfoItemView mBankNum;
    private BankInfoItemView mBankAddress;

    public BankInfoView(Context context) {
        super(context);
    }

    public BankInfoView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public BankInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void init(Context context, AttributeSet attrs, int defStyleAttr) {

    }

    @Override
    protected void initView(Context context) {
        LayoutInflater.from(context).inflate(R.layout.view_bankinfo, this);
        mUserName = findViewById(R.id.view_bank_username);
        mBankName = findViewById(R.id.view_bank_bankname);
        mBankNum = findViewById(R.id.view_bank_banknum);
        mBankAddress = findViewById(R.id.view_bank_address);
        mBankName.setGone();
        mBankAddress.setGone();
    }

    @Override
    protected void load(Context context) {

    }


    public void setUserName(String userName) {
        mUserName.setData("户名:", userName);
        if (Utils.isEmpty(userName)) {
            mUserName.setVisibility(GONE);
        } else {
            mUserName.setVisibility(VISIBLE);
        }
    }

    public void setBankName(String bankName) {
        mBankName.setData("银行:", bankName);
        if (Utils.isEmpty(bankName)) {
            mBankName.setVisibility(GONE);
        } else {
            mBankName.setVisibility(VISIBLE);
        }
    }

    public void setBankNum(String bankNum) {
        mBankNum.setData("卡号:", bankNum);
        if (Utils.isEmpty(bankNum)) {
            mBankNum.setVisibility(GONE);
        } else {
            mBankNum.setVisibility(VISIBLE);
        }
    }

    public void setBankAddress(String bankAddress) {
        mBankAddress.setData("开户行:", bankAddress);
        if (Utils.isEmpty(bankAddress)) {
            mBankAddress.setVisibility(GONE);
        } else {
            mBankAddress.setVisibility(VISIBLE);
        }
    }
}
